﻿using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//文件里添加下面代码，让程序启动时是找到Log4net.config配置文件
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", ConfigFileExtension = "config", Watch = true)]
namespace BusinessService.Plugin.Helper
{
    public static class Log
    {
        //获取配置信息，这里的 InfoLog 和 log4net.config 里的配置命名一致
        public static readonly ILog loginfo = LogManager.GetLogger("InfoLog");
        public static readonly ILog logerror = LogManager.GetLogger("ErrorLog");
        public static void Info(string info)
        {
            if (loginfo.IsInfoEnabled)
            {
                loginfo.Info(info);
            }
        }
        public static void Error(string info, Exception ex)
        {
            if (logerror.IsErrorEnabled)
            {
                logerror.Error(info, ex);
            }
        }
    }
}
